home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu084.dms / pu084.adf / 68020 / Transactor_Article < prev    next >
Text File  |  1992-06-29  |  21KB  |  439 lines

  1. 68020-68881 PLATFORM BOARD, "LUCAS", FOR THE AMIGA 1000
  2.  
  3. Most of you in the Amiga community are well aware of the wonderful
  4. software which is available in the Public Domain. As a hardware type I
  5. have often been envious of the ease with which software can be shared
  6. among developers and users alike. Ideas and techniques can be
  7. distributed through BBS networks to the general benefit of all. In
  8. contrast, hardware developers lead a comparitively solitary existance,
  9. the exchange of ideas impeded by economic and logistical problems.
  10.  
  11. Can there be such a thing as Public Domain Hardware? Obviously no one
  12. can give away printed circuit boards, but perhaps we can do the next
  13. best thing: give away as much information as possible and make bare
  14. PCB's available for as close to cost as shipping allows.
  15.  
  16. The project is a platform board called LUCAS (Little Ugly Cheap
  17. Accelerator System). which replaces the 68000 in your Amiga 1000.
  18. LUCAS provides greater system performance and allows the use of the
  19. 68881 math coprocessor as well as an upgrade path to 32-bit wide
  20. memory.
  21.  
  22. The board has a 68020 and 68881 running at 16 MHz, and interface logic
  23. (consisting of 4 PALS, 4 discretes, 16 MHz crystal, 2 SIP resistor
  24. paks, and some caps) to transpose 68020 cycles to 68000-like cycles.
  25. LUCAS also has a connector which will allow you, at a future date, to
  26. add 32 bit wide memory. (I'll try and get the fine people at
  27. Transactor to publish a memory board for this system in a few months.)
  28.  
  29. Transactor magazine has graciously agreed to make available bare
  30. printed circuit boards for this project for $40.00, and the complete 4
  31. PAL set for $30.00. The rest is readily available from local
  32. suppliers. The schematic is published here, as are the PAL equations.
  33. Anyone who wants the film plots or Net Lists so they can adapt the
  34. form factor to the Amiga 500 is welcome to them for whatever it costs
  35. me to get and ship them to you. (PCB design was done using P-Cad on
  36. er... an AT ( ...almost said the I word )).
  37.  
  38. If you own an Amiga 1000 and you would like to experiment with a 68020
  39. and 68881 combination to improve performance this may be the cheapest
  40. way to get there. Unfortunately the chip set is going to cost you
  41. about $370.00 Canadian. Our aim is to make the rest as cheap as
  42. possible. You should be able to be up and running for under $475.00,
  43. or about three quarters of that if you live in the real world.
  44.  
  45. There are 3 reasons that I decided to do this project. One, I wanted
  46. one myself and couldn't afford the commercial versions. Two, some
  47. friends of mine who are using SCULPT 3D and ANIMATE from Byte by Byte
  48. (both are available in 68020-68881 versions) needed more horsepower to
  49. render their images fast enough to actually make money at it. Three, I
  50. figured all of us Amiga 1000 owners out there with true hacker's
  51. hearts needed some light in our future since 1 meg. of chip ram ain't.
  52. (Maybe some of those 1000's out there can become dedicated rendering
  53. machines.)
  54.  
  55. When I started the design of this board I used as a reference an
  56. article from EDN January 9th 1986 pp216-219. While looking at this
  57. design I became aware of an application note from Motorola AN944/D,
  58. "MC68020 AND MC68881 PLATFORM BOARD FOR EVALUATION IN A 16 BIT
  59. SYSTEM". I recommend both these documents, especially the latter, if
  60. you wish a better understanding of how this board works. Unfortunately
  61. it is impossible within a short article such as this one to give more
  62. than a brief overview of how the board works. I will try and highlight
  63. those aspects which are specific to the Amiga, but a thorough
  64. understanding will require some digging on your part. I also recommend
  65. the User's Manuals for the MC68020 and the MC68881 which are available
  66. from Motorola as "MC68020UM/AD" and "MC68881UM/AD" respectively.
  67.  
  68. O.K. Here is the disclaimer. If you get one of these bare boards and
  69. carefully put it together and then intstall it into your Amiga, you
  70. should have no problem and you'll be up and running in an evening or
  71. two. If you have problems then its up to your ingenuity to solve them.
  72. If you don't have some experience with a soldering iron, please, don't
  73. let this be your debut. I will gladly help anyone with problems. There
  74. are three ways you can get in touch with me, USENET at
  75. anakin@utcs.toronto.edu (Brad Fowles), BIX in the ANAKIN, AMIGA
  76. conference or by regular mail through Transactor. If you do manage get
  77. my phone number you better be able to sweet talk me within 30 seconds.
  78. I hope that if there is sufficient interest out there that local user
  79. groups or individuals will add their help to anyone having problems. I
  80. have no objections should anyone get the bare boards and put them
  81. together and install them for a modest price, but please remember that
  82. the purpose of this is to make these available to end users as cheaply
  83. as possible.
  84.  
  85. If I haven't scared you off, please read on. If I have, well... so
  86. long, and thanks for all the fish.
  87.  
  88. Once you get one of the bare boards and procure all the parts, next
  89. follow the enclosed instructions and carefully solder sockets for all
  90. the IC's and the crystal onto the board. Solder the resistor paks and
  91. the capacitors into place. Insert the 64 Pin header for the 68000
  92. socket and solder it in.
  93.  
  94. Installation is quite simple but should be carefully done. Remove the
  95. plastic cover and the EMI shield from the Amiga base unit. On the
  96. right hand side of the PCB, just beside the Exansion connector, is the
  97. 68000 CPU. Gently pry the 68000 out of its socket, and store it on a
  98. piece of styrofoam somewhere safe. Now insert the LUCAS board into the
  99. 68000 socket, being careful to insure that all 64 pins are correctly
  100. inserted into the socket. If you want to be real careful remove the
  101. disk drive so you can see better. Watch the ribbon cable for the
  102. internal disk drive as the bends in the cable can make things awkward.
  103. As long as you're careful and don't force anything you should have no
  104. problem. You can do initial tests with the cover off, but once you're
  105. satisfied its working put the base unit with its EMI shield back
  106. together again. That's all there is to it. Your heart can now resume
  107. normal operation.
  108.  
  109. You don't need to know a great deal about the inner workings of the
  110. LUCAS board to enjoy using it, but for those who would like a better
  111. understanding of the nature of running a 32-bit 68020 in a 16-bit
  112. 68000 system please read on and I will explain the key points.
  113.  
  114. Once the LUCAS board has been installed we essentially have divided
  115. the CPU time into two discrete blocks. One, seemingly operating at
  116. 7.16 MHz and synchronous to the special purpose chips responsible for
  117. the video, sound, etc. and two, a 16 megahetz asynchronous system
  118. between the 68020 and 68881 and any possible 32-bit wide memory
  119. connected to the LUCAS bus.
  120.  
  121. The essential design criteria I used for the board were that it should
  122. be able to run asyncronously to the Amiga clock (so speeds of 16 MHz
  123. or greater could be achieved) and that there be no connection other
  124. than through the 68000 socket (to simplify installation.)
  125.  
  126. In order to achieve this the board must look like a 68000 (4 clock
  127. standard bus cycle) running at 7.16 MHz when it is running its bus
  128. cycles but when it is doing internal processing or talking to the
  129. MC68881 or future 32 bit wide expansion ram, it should run at the full
  130. 16 MHz (3 clock bus cycle).
  131.  
  132. 90% of the problem in making this board work comes down to the problem
  133. of making the 68020 appear exactly like the original 68000 it replaces
  134. as it has been used architecturally in the Amiga, but able to go like
  135. stink when it gets the chance.
  136.  
  137. The address and data lines are easily implemented as they are
  138. connected directly from the 68020 to the 68000 socket. Note that the
  139. 16 data bits are connected to data bits D16 through D31. The upper
  140. eight address bits on the 68020 are simply left unconnected.
  141.  
  142. I have used the * convention to indicate low true signals for ease in
  143. typesetting the article, i.e., *AS means AS is a low true signal. The
  144. PAL equasions are written in CUPL format so I appologise to all you
  145. PALASM user's.
  146.  
  147.     68020 to 68000 Interface.
  148.  
  149. The 68000 has an asynchonous bus structure. It asserts Address Strobe
  150. (*AS) to begin a bus cycle then waits for the assertion of *DTACK to
  151. end the cycle. This is usually 4 or 6 cycles, but may be held off by
  152. some peripheral device. The 68020 works much the same way except there
  153. are two *DTACK-like signals, *DSACK0 and *DSACK1. Because the 68020
  154. can address in bytes (8 bits), words (16 bits) and longwords (32 bits)
  155. it must be able to differentiate between them. It does this by use of
  156. its dynamic bus sizing capability. A peripheral responds to a bus
  157. cycle by asserting one or both of the *DSACKx signals which tells the
  158. 020 the size of the transfer.
  159.  
  160. DSACK0         DSACK1             TRANSFER SIZE
  161.    0             0             32 bit transfer
  162.    1             0             16 bit transfer
  163.    0             1              8 bit transfer
  164.    1             1             Insert Wait States
  165.  
  166. Bus cycles on for the Amiga are always 16 bits wide so we will assert
  167. only *DSACK1 when responding to Amiga cycles. When we are running
  168. cycles for the 68881 (FPU) or 32-bit wide ram on the LUCAS board
  169. expansion connector we must assert the appropriate *DSACKx
  170. combination.
  171.  
  172. In general terms with no wait states the 68000 will run a bus cycle in
  173. 4 clock cycles; the 020, however, will run the same bus cycle in 3
  174. clock cycles. To correct this we must delay *AS and *DS (Data Strobe)
  175. from reaching the Amiga until after the rising edge of the S2 phase of
  176. the 7.16 Meg. CPU clock. This is accomplished by the flip-flops U8a
  177. and U8b: inverting *AS from the 020 and using the complementary output
  178. with the flip-flop's reset tied to the inverted *AS will delay *AS the
  179. desired amount and terminate *AS20DLY when the *AS from the 020
  180. terminates. This same technique is used for *DS. This creates the two
  181. timing signals *AS20DLY and *DS20DLY.
  182.  
  183. Byte addressability on the 68000 is accomplished by the Upper Data
  184. Strobe (*UDS) and the Lower Data Strobe (*LDS). The 020 has only a
  185. single Data Strobe (*DS). It uses a combination of the two SIZE pins
  186. and A0 and A1 to define the tranfer pattern from the 020's internal
  187. multiplexer to the external data bus. (Note: bytes appear on data bits
  188. 24-31, words appear on data bits 16-31). It is therefore necessary for
  189. us to create *UDS and *LDS. This is accomplished by the following PAL
  190. equations. Note: The data strobes are not asserted during a
  191. Coprocessor cycle. (CPCS)
  192.  
  193. !UDS = (!DS20DLY) & (!A0)   & (CPCS)
  194. !LDS = (!DS20DLY) & ( SIZ1) & (CPCS)
  195.        (!DS20DLY) & (!SIZ0) & (CPCS) 
  196.        (!DS20DLY) & (  A0 ) & (CPCS)
  197.  
  198. The 68000 contains logic to support the 6800 family of products, and
  199. the Amiga uses this to interface to the 8250s. We must also emulate
  200. this interface as it is not present on the 020. A secondary clock
  201. called the E clock must be generated. It has a frequency of 1/10th the
  202. CPU clock and has a duty cycle of 60% low and 40% high. This is done
  203. by a decade counter in PAL U4. When running a 6800 family cycle the
  204. Amiga or peripheral generates a Valid peripheral Address signal
  205. (*VPA). The 68000 then syncs itself with the E clock and issues a
  206. Valid Memory Address (*VMA) and ends the cycle on the falling edge of
  207. the E clock. The equation,
  208.  
  209. !Z3 = !QD #
  210.       QC #
  211.       QB #
  212.       QA ;
  213.  
  214. on PAL U4 in combination with the equation
  215.  
  216. !Z1.D = (DS20DLY) & (!Z1) #
  217.         (DS20DLY) & ( Z3) & (!VMA);
  218.  
  219. asserts *DSACK1 in the 9th state of E clock by the generation of the
  220. Z1 signal so that the long VPA, VMA cycle can be terminated correctly.
  221.  
  222. 68020 to 68881 Interface
  223.  
  224. The MC68881 chip select (*CS) must be decoded from the 020. The 020
  225. generates a 111 on the Function Code pins (CPU Space), a 0010 on the
  226. address lines A16-A19 which means this is a FPU coprocessor cycle, and
  227. a coprocessor ID on Address lines A13-A15. Since there is only one
  228. coprocessor in this design, A13-A15 are undecoded. The rest is decoded
  229. by PAL U4 in the following equation:
  230.  
  231. CPCS = (FC2)&(FC1)&FC0)&(!A19)&(!A18)&(A17)&(!A16)
  232.  
  233. This generates the *CS (Chip Select) to the 68881.
  234.  
  235. Zen and the Art of Cycle Termination
  236.     (An Asynchronous Synchronous Asynchronicity.)
  237.  
  238. The generation of the *DSACK1 signal from the Amiga *DTACK caused me
  239. at times to doubt not only my own sanity but that of the universe
  240. itself. The *DTACK signal from the Amiga should appear and be sampled
  241. during the S4 phase of the clock cycle. Unfortunately it doesn't quite
  242. know that. It responds more or less correctly when it is talking to
  243. internal ram but when external (FAST) ram is accessed *DTACK comes
  244. back almost right away. Remember that *DTACK is the only way we have
  245. of determining the length of a cycle. We will cope with this anomaly
  246. in a moment.
  247.  
  248. Since the 020 is operating at 16 MHz - i.e., quite asynchronous to the
  249. Amiga clock - you have to sync up somewhere along the line with the
  250. Amiga 7.16 MHz clock. The ideal place to do this is when the two Amiga
  251. clocks C1 and C3 are in the condition C1 high and C3 low. These
  252. signals are not available at the processor and for a long time I had
  253. these two lines coming up off the motherboard. However the 7.16 MHz
  254. clock that is available at the processor can produce a reasonable
  255. facsimile. I divide the 7.16 MHz clock by two using U9a then logically
  256. OR it with the original 7.16 MHz clock and this turns out to have the
  257. same timing as C1 high and C3 low (my faith in the universe began to
  258. rekindle at this point.)
  259.  
  260. In the PAL equations this is DTPRELIM (DTack PRELIMinary). Now we have
  261. a reference point to sync back up with the Amiga.
  262.  
  263. In a saner world the combination of *DTACK and the Z1 signal (for
  264. termination of VPA,VMA cycles) would be sufficient to create the term
  265. SYSDSPRE1 (SYStem DSack1 PREliminary 1), but we have to delay till
  266. *DTPRELIM is true to sync up with the Amiga, plus cope with the quick
  267. responce of *DTACK anomaly when talking to fast ram. And sync back up
  268. with the 16 MHz 68020 when we do finally issue a *DSACK1.
  269.  
  270. Confused? Wait! It gets better.
  271.  
  272. Most dynamic memory boards when connected to the Amiga expansion bus
  273. will assert XRDY to hold off the assertion of *DTACK while they do a
  274. refresh cycle. This puts in enough wait states so that the memory
  275. board can complete a refresh cycle. Problem is, soon as XRDY is
  276. asserted, a 20-30 ns. glitch occurs in *DTACK, prompting the 020 to
  277. terminate the cycle before the data is even thinking about arriving on
  278. the bus. The solution is to avoid decoding it till the S4 phase of the
  279. Amiga 7.16 MHz clock. I delay *AS20DLY again for *DTQUAL and again for
  280. *DTQUAL1. DTQUAL becomes part of the *DTACK term and *DTQUAL1 is wired
  281. to QUAL (I needed the 7ns. across the PAL) then QUAL is added to the
  282. *DTACK term, giving:
  283.  
  284. !SYSDSPRE1 = !Z1#     
  285.  
  286.        (!DTACK)&(!AS20DLY)&(!DTQUAL)&(!QUAL)
  287.  
  288. This soves the quick *DTACK problem.
  289.  
  290. We buffer this (another 7 ns.) by:
  291.  
  292. !BUFOUT = !SYSDSPRE1
  293.  
  294. Add in the Amiga syncronizing term
  295.  
  296. !DTTRIG = (!BUFOUT) & (!DTPRELIM)
  297.  
  298. Now we have an edge which is syncronous to the 7.16 MHz Amiga system.
  299. We then use this to trigger a Flip-Flop which has patiently been
  300. waiting for all this tom-foolery to end and will ship !SYSDACK1 to yet
  301. another Flip-Flop to sync it back up to the 16 MHz 020 clock, and then
  302. to the awaiting PAL U7 for additional decoding. I feed the Flip-Flop
  303. U9b with *ASDLY so that the !SYSDSACK1 signal will terminate when *AS
  304. does.
  305.  
  306. We're almost done.
  307.  
  308. PAL U7 then combines *SYSDSACK1 with the 68881 *DSACK1 , CPDSACK1, and
  309. *SRDSACK1 (which comes from the expansion connector for future Static
  310. Ram), and finally and enthusiastically begets *DSACK1.
  311.  
  312. What could be simpler?
  313.  
  314. *DSACK0 is generated from the 68881 and from the future Static Ram only. 
  315.  
  316.  
  317. Bus Arbitration
  318.     
  319. The Bus arbitration technique is quite similer to the 68000 with one
  320. exception. During coprocessor cycles the *AS is blocked from the 68000
  321. bus. This gives rise to a possible problem. If the 68020 begins a
  322. coprocessor cycle with *AS blocked and responds to a alternate bus
  323. master's *BR (Bus Request) with a *BG (Bus Grant) the 68020 will
  324. assume the alternate bus master will wait for the negation of *AS.
  325. Unfortunately *AS is blocked and therefore already negated. The result
  326. is bus contention. Therefore we must prevent the assertion of *BG
  327. until the interface negates *AS. This is done with the equation,
  328.  
  329.  !BG00 = (!BG20) & (!Z2) & (AS20)
  330.  
  331.     Benchmarks
  332.  
  333. To give some idea of the performance improvement you can expect with
  334. the 68020-68881 pair, I have used 4 programs made available on the
  335. DEVCON disks distributed at the Washington Developer's Conference.
  336. Thanks to Al Aburto for letting me distribute them. These benchmarks
  337. were run on an Amiga 1000 with a 2 Meg. Micrbotics Starboard memory
  338. board and a Comspec 20 Meg. Hard Disk. The operating system was
  339. Kickstart 1.2.1 and Workbench 1.3 Gamma 7. It should be noted that
  340. when the 68020-68881 pair is installed the new IEEE math libraries
  341. which support the 68881 are used for floating-point transparently. I
  342. ran these benchmarks first with a standard 68000 and then with the
  343. LUCAS board.
  344.  
  345. Savage:
  346.         68000    470.0 sec.    Error -6.9e-7
  347.         LUCAS    14.5 sec.    Error -5.7e-4
  348. Whetstone:
  349.         68000    24  kwhets/sec.
  350.         LUCAS    126 kwhets/sec.
  351. Calcpi:
  352.         68000    4.85 kflops/sec.    Error -1.39e-11
  353.         LUCAS    11.9 kflops/sec.    Error -2.78e-11
  354. Float:
  355.         68000    10000 interations     45.74 sec.
  356.                256000 interations    286.96 sec.
  357.         LUCAS    10000 interations     12.80 sec.
  358.                256000 interations    118.56 sec.
  359.  
  360. Of course speed could be further enhanced by using inline F
  361. instructions for the floating point stuff and even further enhanced by
  362. using 32-bit wide no-wait-state Static Memory.
  363.  
  364. Please remember that benchmarks are like political speeches, they only
  365. seem to make sense.
  366.  
  367. Software Considerations
  368.  
  369. Most software runs just fine on the 68020 but there are some programs
  370. which will guru on you. One of the major reasons for this is that on
  371. the 68020 all the instructions that are on the 68000 are implemented
  372. with the inevitable exception of one: the MOVE SR <ea> instruction. On
  373. the 68000 this is a user mode instruction; on the 68020 (and 68010 and
  374. later parts) it is a supervisor mode only instruction, i.e., if its
  375. executed on a 68020 in an Amiga you get a privelige violation guru. If
  376. you're writing software, don't use this instruction; use instead the
  377. GetCC() library function which translates to a MOVE CC <ea> on the
  378. 68020, which is a valid user mode instruction. This function
  379. translates to a MOVE SR <ea> if there is a 68000 in the Amiga. This
  380. way you're safe both ways.
  381.  
  382. If you're one of those people who thought encoding information in the
  383. upper 8 bits of the address field was a nifty idea ... Oh well, time
  384. to learn the error of your ways.
  385.  
  386. Of course if you use any instructions from the 68020 super set then
  387. this code will never run on a standard Amiga. For further information
  388. see section 21 of the Washington Amiga Developer Conference Notes,
  389. "Software Issues in 32-bit Amiga Systems" by Dave Haynie.
  390.  
  391. The new release of 1.3 has new IEEE Double Precision Math Libraies
  392. which take advantage of the 68020-68881 pair if it is present and can
  393. immediately speed up any existing programs which use the math
  394. libraries.
  395.  
  396. If you want blindingly fast floating point the best way is to
  397. recompile your code so that it uses direct inline F instructions. I am
  398. making available on the Transactor Disks two programs called Mandslow
  399. and Mandfast. They are slight adaptations of RJ's original mandelbrot
  400. program, adapted by Eric Haberfellner. These two programs are the same
  401. except that mandslow was compiled for standard Amiga while mandfast
  402. was compiled to use inline F instructions. As an example a moderately
  403. deep mandelbrot which runs in 1 hr. 20 min. on a standard Amiga runs
  404. in 4 min. 20 sec. with the LUCAS board installed.
  405.  
  406. Compatibility
  407.  
  408. The LUCAS board works with all the expansion boards I have but I'm
  409. sure there will be some out there that will bomb out. I will keep a
  410. list of those that do and those that don't and post it regularly on
  411. Usenet and BIX. The ones I have are the Comspec 20 Meg. Hard Disk,
  412. Comspec 2 Meg. Memory board, EASYL, and the Micobotics Starboard 2
  413. Meg. Memory board.
  414.  
  415. As a matter of interest only, the board works fairly well at 20 MHz
  416. but periodically bombs. I have only 16 MHz parts; when I debug the
  417. bomb it seems to be the fault of the on-chip instruction cache. If you
  418. have 20 MHz parts, try it and let me know. Even if you have 16 MHz
  419. parts its worth the price of a 20 MHz crystal to see if it will work.
  420. Who knows? You might get lucky.
  421.  
  422. Conclusion
  423.  
  424. The performance of the Amiga 1000 with the LUCAS board intalled will
  425. be improved, but it won't perform miracles. For general purpose
  426. computing I find that compiles are only about 1.4 times faster, hardly
  427. worth the trouble. However, any program which uses Floating point will
  428. be improved considerably, and those which have embedded F instructions
  429. will indeed appear miraculous. On the other hand, the board does allow
  430. for 32-bit wide expansion memory, and if installed you can expect
  431. considerable general purpose performance improvements as well. I plan
  432. to design two boards: one with standard 100 or 120 ns. DRAMs and a
  433. second with some high speed Static Ram for no wait state operation at
  434. 16 MHz. You get most of the performance increase by having the memory
  435. 32 bits wide, but I can't resist seeing how fast it will go with no
  436. wait states at 16 MHz.
  437.  
  438. Stay tuned to Transactor and the Nets for updates. Enjoy!
  439.